// 创建一个URL对象
var url = new URL("https://example.com/page?name=John&age=30");

// 获取当前的search属性值
console.log(url.search); // 输出: "?name=John&age=30"

// 修改search属性
url.search = "?city=NewYork";

// 查看修改后的URL
console.log(url.href); // 输出: "https://example.com/page?city=NewYork"
